# == Class ceph::install
#
# This class is called from ceph for install.
#

define ceph::install::unit_array() {
  file { "/etc/systemd/system/${name}":
      owner  => 'root',
      group  => 'root',
      mode   => '0644',
      source => "puppet:///modules/ceph/units/${name}",
      notify => Exec['Reload systemd'],
  }
}

class ceph::install {
  exec { 'Reload systemd':
    command     => '/usr/bin/systemctl daemon-reload',
    refreshonly => true,
  }

  unit_array { [
      'ceph-disk-activate-journal@.service',
      'ceph-disk-activate@.service',
      'ceph-mon@.service',
      'ceph-osd@.service',
      'rbdmap.service',
    ]:
  }

  file { '/etc/udev/rules.d/95-ceph-osd.rules':
    owner  => 'root',
    group  => 'root',
    mode   => '0644',
    source => 'puppet:///modules/ceph/udev/95-ceph-osd.rules',
  }

  file { '/usr/bin/rbdmap':
    owner  => 'root',
    group  => 'root',
    mode   => '0755',
    source => 'puppet:///modules/ceph/bin/rbdmap',
  }

  ensure_resource('package', 'redhat-lsb-core', {
    ensure => latest,
    before => Package[$::ceph::package_name],
  })
  package { $::ceph::package_name:
    ensure => latest,
  }
}
